
%This graph program is the replication code dfor Figure 4, based on
%simulations of Simulate_Concentration_HighOP_func.m. The variable o
%represents fixed costs and is parameterized in the simulation program (in place of "m" used in the paper, which is used for other purposes in the simulation program).
% The fixed-to-marginal cost ratio is hence given by o/h, where h is varied
% over an interval. The resultant fixed-to-marginal cost ratios are in a
% lower region compared with Figure 3.


clear;
clc;
close all;
set(groot,'defaulttextinterpreter','latex');
set(groot,'defaultAxesTickLabelInterpreter','latex');
set(groot,'defaultLegendInterpreter','latex');


%% Color Scheme
co = [   0    0.4470    0.7410;
    0.8500    0.3250    0.0980;
    0.9290    0.6940    0.1250;
    0.4940    0.1840    0.5560;
    0.4660    0.6740    0.1880;
    0.3010    0.7450    0.9330;
    0.6350    0.0780    0.1840];

co2 = [   0         0    1.0000;
    0    0.5000         0;
    1.0000         0         0;
    0    0.7500    0.7500;
    0.7500         0    0.7500;
    0.7500    0.7500         0;
    0.2500    0.2500    0.2500];

variable_N = 2:1:8;
variable_h = 1.17:0.01:1.21;


for j = 1:length(variable_N)
    for k = 1:length(variable_h)
        h_rp(j,k) = Simulate_Concentration_HighOPNSDF_func(variable_N(j), variable_h(k));
        n_h_graph(j,k) = variable_N(j);
        h_graph(j,k) = variable_h(k);
        oh_graph(j,k)= 0.25/variable_h(k);
    end
end


%------------------------variable N and o------------------------------
rp = h_rp;



clc;
surf(n_h_graph,oh_graph,100*rp);
zlabel('Mean Return (%)', 'interpreter', 'latex')
xlabel('Number of Firms', 'interpreter', 'latex')
ylabel('Fixed-to-Marginal Cost Ratio', 'interpreter', 'latex')
set(gca,'FontSize',15)
set(gcf, 'Position', [300 300 1200 540])

%for jpeg
f = gcf;
set(f, 'Position', [298   180   691   586]);
ax = gca;
ax.YLabel.Rotation = 335;
ax.XLabel.Rotation = 15;
exportgraphics(f,strcat('Figure',num2str(4),'.jpg'),'BackgroundColor','none')


clc;




